{include file="public/header" /}
<div class="header">
	<span>广告列表</span>
	<button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="add()">
		<i class="layui-icon layui-icon-add-1"></i>添加
	</button>
	<div></div>
</div>
<table class="layui-table">
	<thead>
		<tr>
			<th>排序</th>
			<th>ID</th>
			<th>标题</th>
			<th>图片</th>
			<th>url</th>
			<th>状态</th>
			<th>位置</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		{volist name="lists" id='vo'}
			<tr>
				<td>{$vo.sort}</td>
				<td>{$vo.id}</td>
				<td>{$vo.title}</td>
				<td><img style="width:100px;height:100px;" src="{$config['admin_domain'].$vo['img']}" class="layui-upload-img" onmouseover="show_img(this)" onmouseleave="hide_img()"></td>
				<td>{$vo.url}</td>
				<td>
					{if($vo['status']==1)}
						开启
					{elseif($vo['status']==0)/}
						<span style="color:red;">关闭</span>
					{/if}
				</td>
				<td>
					{if($vo['position']==1)}
						首页banner图
					{/if}
				</td>
				<td>
					<button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="edit({$vo.id})">
						<i class="layui-icon layui-icon-edit"></i>编辑
					</button>
				</td>
			</tr>
		{/volist}
	</tbody>
</table>
<script type="text/javascript">
	layui.use(['layer'],function(){
		layer = layui.layer;
		$ = layui.jquery;
	});
	// 添加
	function add(){
		layer.open({
			type: 2,
			title: '添加',
			shade: 0.3,
			area: ['650px','650px'],
			content: "{$config['admin_route']}oyk/ad_add"
		});
	}
	// 编辑
	function edit(id){
		layer.open({
			type: 2,
			title: '编辑',
			shade: 0.3,
			area: ['650px','650px'],
			content: "{$config['admin_route']}oyk/ad_edit?id="+id
		});
	}
</script>
{include file="public/tail" /}